home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12372 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: castle.nando.net!news
  2. From: Caius Martius <caius@nando.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Operator overload problem!
  5. Date: Tue, 19 Mar 1996 13:54:52 -0800
  6. Organization: Nando.net
  7. Message-ID: <314F2D2C.6AB5@nando.net>
  8. References: <DoIn1z.Gou@latcs1.lat.oz.au>
  9. NNTP-Posting-Host: grail1307.nando.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win95; I; 16bit)
  14.  
  15. Gregary J Boyles wrote:
  16. > I am trying to overload the << but I get the syntax errors : friends must be functions or
  17. > classes, 'ostream' cannot start a parameter declaration, 'Address::operator <<(int &,Address &)'
  18. > must be declared at the first set of astericks and declaration syntax error at the second set.
  19. > What the #$%& is it on about? I copied the operator overload function directly out of a program
  20. > which compiles and runs so why all of a sudden won't the bloody compiler accept it?
  21.  
  22. > // Operator overloads
  23. > ***************************************************************
  24. >                                                               *
  25. > ostream& operator <<(ostream& OutPutStream,Address& AnAddress)*
  26. >                                                               *
  27. > ***************************************************************
  28. > {
  29. >      OutPutStream<<"Street : "<<AnAddress.Number<<" "<<AnAddress.Street<<EOLN;
  30. >      OutPutStream<<"City : "<<AnAddress.City<<EOLN;
  31. >      OutPutStream<<"Zip code : "<<AnAddress.Zip<<EOLN;
  32. > }
  33.  
  34. I am not familiar with the command EOLN...  I think you want to use
  35. endl instead...
  36.